package com.nainiujia.jinlong.aahelper;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;

import android.widget.Button;
import android.widget.EditText;


import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;


@EActivity(R.layout.activity_init)
public class InitActivity extends AppCompatActivity {

    @ViewById(R.id.et_number)
     EditText num_et;

    @ViewById(R.id.but_sure)
     Button  sure_bt;

    public  static final String People_Key = "peoples";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       // setContentView(R.layout.activity_init);
    }

    @Click(R.id.but_sure)
    void goToMainActivity(){


        //Toast.makeText(this,num_et.getText(),Toast.LENGTH_LONG).show();

        String number_str = num_et.getText().toString().trim();

        if(!TextUtils.isEmpty(number_str)){


            int number = Integer.parseInt(number_str);

            Intent intent  = new Intent(this,MainActivity.class);

            intent.putExtra(People_Key,number);
            startActivity(intent);
            finish();
        }

    }
}
